home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Original Code / Lines Curves and Area Fills / AntiAlias / AntiAlias.cs next >
Encoding:
Text File  |  2001-01-15  |  849 b   |  32 lines

  1. //----------------------------------------
  2. // AntiAlias.cs ⌐ 2001 by Charles Petzold
  3. //----------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Drawing.Drawing2D;
  7. using System.Windows.Forms;
  8.  
  9. class AntiAlias: Form
  10. {
  11.      public static void Main()
  12.      {
  13.           Application.Run(new AntiAlias());
  14.      }
  15.      public AntiAlias()
  16.      {
  17.           Text = "Anti-Alias Demo";
  18.           BackColor = SystemColors.Window;
  19.           ForeColor = SystemColors.WindowText;
  20.      }
  21.      protected override void OnPaint(PaintEventArgs pea)
  22.      {
  23.           Graphics grfx = pea.Graphics;
  24.           Pen      pen  = new Pen(ForeColor);
  25.  
  26.           grfx.SmoothingMode   = SmoothingMode.None;
  27.           grfx.PixelOffsetMode = PixelOffsetMode.Default;
  28.  
  29.           grfx.DrawLine(pen, 2, 2, 18, 10);
  30.      }
  31. }
  32.